<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/gui/kernel/qx11embed_x11.cpp -->
<head>
  <title>Qt 4.3: QX11EmbedContainer Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QX11EmbedContainer Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QX11EmbedContainer class provides an XEmbed container widget. <a href="#details">More...</a></p>
<pre> #include &lt;QX11EmbedContainer&gt;</pre><p>Inherits <a href="qwidget.html">QWidget</a>.</p>
<ul>
<li><a href="qx11embedcontainer-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public Types</h3>
<ul>
<li><div class="fn"/>enum <b><a href="qx11embedcontainer.html#Error-enum">Error</a></b> { Unknown, InvalidWindowID }</li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qx11embedcontainer.html#QX11EmbedContainer">QX11EmbedContainer</a></b> ( QWidget * <i>parent</i> = 0 )</li>
<li><div class="fn"/><b><a href="qx11embedcontainer.html#dtor.QX11EmbedContainer">~QX11EmbedContainer</a></b> ()</li>
<li><div class="fn"/>WId <b><a href="qx11embedcontainer.html#clientWinId">clientWinId</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qx11embedcontainer.html#discardClient">discardClient</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qx11embedcontainer.html#embedClient">embedClient</a></b> ( WId <i>id</i> )</li>
<li><div class="fn"/>Error <b><a href="qx11embedcontainer.html#error">error</a></b> () const</li>
</ul>
<ul>
<li><div class="fn"/>201 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li><div class="fn"/>12 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="signals"></a>
<h3>Signals</h3>
<ul>
<li><div class="fn"/>void <b><a href="qx11embedcontainer.html#clientClosed">clientClosed</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qx11embedcontainer.html#clientIsEmbedded">clientIsEmbedded</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qx11embedcontainer.html#error-2">error</a></b> ( QX11EmbedContainer::Error <i>error</i> )</li>
</ul>
<ul>
<li><div class="fn"/>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>56 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li><div class="fn"/>19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"/>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>38 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"/>1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
<li><div class="fn"/>1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QX11EmbedContainer class provides an XEmbed container widget.</p>
<p>XEmbed is an X11 protocol that supports the embedding of a widget from one application into another application.</p>
<p>An XEmbed <i>container</i> is the graphical location that embeds an external <i>client widget</i>. A client widget is a window that is embedded into a container.</p>
<p>When a widget has been embedded and the container receives tab focus, focus is passed on to the widget. When the widget reaches the end of its focus chain, focus is passed back to the container. Window activation, accelerator support, modality and drag and drop (XDND) are also handled.</p>
<p>QX11EmbedContainer is commonly used for writing panels or toolbars that hold applets, or for <i>swallowing</i> X11 applications. When writing a panel application, one container widget is created on the toolbar, and it can then either swallow another widget using embed(), or allow an XEmbed widget to be embedded into itself. The container's X11 window ID, which is retrieved with <a href="qwidget.html#winId">winId</a>(), must then be known to the client widget. After embedding, the client's window ID can be retrieved with <a href="qx11embedcontainer.html#clientWinId">clientWinId</a>().</p>
<p>In the following example, a container widget is created as the main widget. It then invokes an application called &quot;playmovie&quot;, passing its window ID as a command line argument. The &quot;playmovie&quot; program is an XEmbed client widget. The widget embeds itself into the container using the container's window ID.</p>
<pre> int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);

     if (app.arguments().count() != 2) {
         qFatal(&quot;Error - expected executable path as argument&quot;);
         return 1;
     }

     QX11EmbedContainer container;
     container.show();

     QProcess process(&amp;container);
     QString executable(app.arguments()[1]);
     QStringList arguments;
     arguments &lt;&lt; QString::number(container.winId());
     process.start(executable, arguments);

     int status = app.exec();
     process.close();
     return status;
 }</pre>
<p>When the client widget is embedded, the container emits the signal <a href="qx11embedcontainer.html#clientIsEmbedded">clientIsEmbedded</a>(). The signal <a href="qx11embedcontainer.html#clientClosed">clientClosed</a>() is emitted when a widget is closed.</p>
<p>It is possible for QX11EmbedContainer to embed XEmbed widgets from toolkits other than Qt, such as GTK+. Arbitrary (non-XEmbed) X11 widgets can also be embedded, but the XEmbed-specific features such as window activation and focus handling are then lost.</p>
<p>The GTK+ equivalent of QX11EmbedContainer is GtkSocket. The KDE widget is called QXEmbed.</p>
<p>See also <a href="qx11embedwidget.html">QX11EmbedWidget</a> and <a href="http://www.freedesktop.org/Standards/xembed-spec">XEmbed Specification</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="fn"><a name="Error-enum"></a>enum QX11EmbedContainer::Error</h3>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QX11EmbedContainer::Unknown</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">An unrecognized error occurred.</td></tr>
<tr><td valign="top"><tt>QX11EmbedContainer::InvalidWindowID</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The X11 window ID of the container was invalid. This error is usually triggered by passing an invalid window ID to embed().</td></tr>
</table></p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QX11EmbedContainer"></a>QX11EmbedContainer::QX11EmbedContainer ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
<p>Creates a <a href="qx11embedcontainer.html">QX11EmbedContainer</a> object with the given <i>parent</i>.</p>
<h3 class="fn"><a name="dtor.QX11EmbedContainer"></a>QX11EmbedContainer::~QX11EmbedContainer ()</h3>
<p>Destructs a <a href="qx11embedcontainer.html">QX11EmbedContainer</a>.</p>
<h3 class="fn"><a name="clientClosed"></a>void QX11EmbedContainer::clientClosed ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted by the container when the client widget closes.</p>
<h3 class="fn"><a name="clientIsEmbedded"></a>void QX11EmbedContainer::clientIsEmbedded ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted by the container when a client widget has been embedded.</p>
<h3 class="fn"><a name="clientWinId"></a><a href="qwidget.html#WId-typedef">WId</a> QX11EmbedContainer::clientWinId () const</h3>
<p>If the container has an embedded widget, this function returns the X11 window ID of the client; otherwise it returns 0.</p>
<h3 class="fn"><a name="discardClient"></a>void QX11EmbedContainer::discardClient ()</h3>
<p>Detaches the client from the embedder. The client will appear as a standalone window on the desktop.</p>
<h3 class="fn"><a name="embedClient"></a>void QX11EmbedContainer::embedClient ( <a href="qwidget.html#WId-typedef">WId</a> <i>id</i> )</h3>
<p>Instructs the container to embed the X11 window with window ID <i>id</i>. The client widget will then move on top of the container window and be resized to fit into the container.</p>
<p>The <i>id</i> should be the ID of a window controlled by an XEmbed enabled application, but this is not mandatory. If <i>id</i> does not belong to an XEmbed client widget, then focus handling, activation, accelerators and other features will not work properly.</p>
<h3 class="fn"><a name="error"></a><a href="qx11embedcontainer.html#Error-enum">Error</a> QX11EmbedContainer::error () const</h3>
<p>Returns the last error that occurred.</p>
<h3 class="fn"><a name="error-2"></a>void QX11EmbedContainer::error ( <a href="qx11embedcontainer.html#Error-enum">QX11EmbedContainer::Error</a> <i>error</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This is an overloaded member function, provided for convenience.</p>
<p>This signal is emitted if an error occurred when embedding or communicating with a client. The specified <i>error</i> describes the problem that occurred.</p>
<p>See also <a href="qx11embedcontainer.html#Error-enum">QX11EmbedContainer::Error</a>.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
